package ac.github.os.internal.core.action.plugin

import ac.github.os.internal.core.action.Action
import ac.github.os.internal.core.config.StringConfig
import ac.github.os.internal.core.config.get
import ac.github.os.internal.session.Cache
import ac.github.os.internal.session.Session
import taboolib.common.platform.Awake

@Awake
class DelayAction : Action {
    override fun onExecute(session: Session, cache: Cache, config: StringConfig) {
        /**
         * 1000 / 50
         */
        config.get<Long>("tick", single = true)?.apply {
            Thread.sleep(this * 50)
        }
    }

    override val type: Action.Type
        get() = Action.Type.AIR
    override val namespace: String
        get() = "delay"
}